<?php
namespace Mageplaza\HelloWorld\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    /**
     * Install Tax Classes & Customer Attribute
     *
     * {@inheritDoc}
     *
     * MEQP2 Warning: $context necessary for interface
     *
     * @see \Magento\Framework\Setup\InstallDataInterface::install()
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    protected  $_postFactory;
    public function __construct(\Mageplaza\HelloWorld\Model\PostFactory $postFactory)
    {
        $this->_postFactory = $postFactory;
    }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
         $arr=['name'=>'1234445','url_key'=>'www.baidu'];
         $arr1=['name'=>'12344451','url_key'=>'www.baidu'];
         $arr2=['name'=>'123444512','url_key'=>'www.baidu'];
         //$clas = $setup->getTable("mageplaza_helloworld_post");
         $st =$setup->getConnection()->insert("mageplaza_helloworld_post",$arr);
        $clas = $setup->getTable("mageplaza_helloworld_post");
        $setup->getConnection()->insertForce($clas,$arr1);
        $post = $this->_postFactory->create();
        $post->addData($arr2)->save();



        //        $taxClassTable = $setup->getTable('tax_class');
        //        $select = $setup->getConnection()->select()->from($taxClassTable);
        //        $query = $setup->getConnection()->query($select)

    }
}